<?php 
session_start();
if( empty($_SESSION['userName']) || empty($_SESSION['userId']) ):
?>
<script type="text/javascript">
//this.location.replace('login.php');
parent.location.replace('login.php');
</script>
<?php
endif;

?>